﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Common;
using System.Data;

/// <summary>
/// Summary description for dataAccess
/// </summary>

   public abstract class dataAccess
    {

       private string _connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["conexao"].ToString();

       protected string ConnectionString
        {
            get { return _connectionString; }
            set { _connectionString = value; }
        }

        //private bool _enableCache = true;
        //protected bool EnableCache
        //{
        //    get { return _enableCache; }
        //    set { _enableCache = value; }
        //}

        //private int _cacheDuration = 0;
        //protected int CacheDuration
        //{
        //    get { return _cacheDuration; }
        //    set { _cacheDuration = value; }
        //}

        //protected Cache Cache
        //{
        //    get { return HttpContext.Current.Cache; }
        //}

        protected int ExecuteNonQuery(DbCommand db)
        {
            return db.ExecuteNonQuery();
        }

        protected IDataReader ExecuteReader(DbCommand cmd)
        {
            return ExecuteReader(cmd, CommandBehavior.Default);
        }

        protected IDataReader ExecuteReader(DbCommand cmd, CommandBehavior behavior)
        {
            return cmd.ExecuteReader(behavior);
        }

        protected object ExecuteScalar(DbCommand cmd)
        {
            return cmd.ExecuteScalar();
        }


    }
